package org.jeecg.modules.wlhy.shipping.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.api.controller.ShippingVo;
import org.jeecg.modules.api.wlhy.customer.HyShippingNoteTongJiDTO;
import org.jeecg.modules.wlhy.shiboetc.ShiboEtcReportDTO;
import org.jeecg.modules.wlhy.shipping.dto.LnTaxShippingNoteDTO;
import org.jeecg.modules.wlhy.shipping.dto.YunFuTongShippingNoteDTO;
import org.jeecg.modules.wlhy.shipping.entity.*;
import org.jeecg.modules.wlhy.wlxypt.entity.XlyReportDTO;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * @Description: 运单表
 * @Author: jeecg-boot
 * @Date: 2020-12-05
 * @Version: V1.0
 */
public interface HyShippingNoteMapper extends BaseMapper<HyShippingNote> {

    int getCountByDate(@Param("dateString") String dateString);

    HyShippingNote queryByShippingNoteNumber(@Param("shippingNoteNumber") String shippingNoteNumber);

    List<ShippingMonthTotalDTO> getShippingMonthTotal(
            @Param("customerId") String customerId,
            @Param("startMonth") String startMonth,
            @Param("endMonth") String endMonth);

    Integer getVehicleAmounthyByOrderId(@Param("orderId") String orderId);

    IPage<HyShippingNoteDTO> getPageList(
            Page<HyShippingNoteDTO> page,
            @Param(Constants.WRAPPER) QueryWrapper<HyShippingNoteDTO> queryWrapper
    );

    IPage<LnTaxShippingNoteDTO> getLnTaxPageList(
            Page<LnTaxShippingNoteDTO> page,
            @Param(Constants.WRAPPER) QueryWrapper<LnTaxShippingNoteDTO> queryWrapper
    );

    IPage<HyShippingNoteDTO> getNucarEtcPageList(
            Page<HyShippingNoteDTO> page,
            @Param(Constants.WRAPPER) QueryWrapper<HyShippingNoteDTO> queryWrapper
    );


    IPage<HyShippingNoteDTO> getPageCheckList(
            Page<HyShippingNoteDTO> page,
            @Param(Constants.WRAPPER) QueryWrapper<HyShippingNoteDTO> queryWrapper
    );

    IPage<UpDataShippingNoteDTO> getUpDataPageList(
            Page<UpDataShippingNoteDTO> page,
            @Param(Constants.WRAPPER) QueryWrapper<UpDataShippingNoteDTO> queryWrapper
    );

    //Added at 2023-10-23 for 增加园区单独上报功能
    IPage<UpDataShippingNoteDTO> getParkUpDataPageList(
            Page<UpDataShippingNoteDTO> page,
            @Param(Constants.WRAPPER) QueryWrapper<UpDataShippingNoteDTO> queryWrapper
    );

    //Added at 2024-01-31 for 增加淮北单独上报功能
    IPage<UpDataShippingNoteDTO> getHuaibeiUpDataPageList(
            Page<UpDataShippingNoteDTO> page,
            @Param(Constants.WRAPPER) QueryWrapper<UpDataShippingNoteDTO> queryWrapper
    );

    //Added at 2024-01-31 for 增加鄂尔多斯市单独上报功能
    IPage<UpDataShippingNoteDTO> getOrdosUpDataPageList(
            Page<UpDataShippingNoteDTO> page,
            @Param(Constants.WRAPPER) QueryWrapper<UpDataShippingNoteDTO> queryWrapper
    );

    IPage<TaxUpDataShippingNoteDTO> getTaxUpDataPageList(
            Page<TaxUpDataShippingNoteDTO> page,
            @Param(Constants.WRAPPER) QueryWrapper<TaxUpDataShippingNoteDTO> queryWrapper
    );

    IPage<DaodaUpDataShippingNoteDTO> getDaodaUpDataPageList(
            Page<DaodaUpDataShippingNoteDTO> page,
            @Param(Constants.WRAPPER) QueryWrapper<DaodaUpDataShippingNoteDTO> queryWrapper
    );

    IPage<TongdaUpDataShippingNoteDTO> getTongdaUpDataPageList(
            Page<TongdaUpDataShippingNoteDTO> page,
            @Param(Constants.WRAPPER) QueryWrapper<TongdaUpDataShippingNoteDTO> queryWrapper
    );



    IPage<EtcFeecloudsShippingNoteDTO> getEtcFeecloudsList(
            Page<EtcFeecloudsShippingNoteDTO> page,
            @Param(Constants.WRAPPER) QueryWrapper<EtcFeecloudsShippingNoteDTO> queryWrapper
    );


    List<HyShippingNoteDTO> getList(@Param(Constants.WRAPPER) QueryWrapper<HyShippingNoteDTO> queryWrapper);

    List<UpDataShippingNoteDTO> getUpDataPageList(@Param(Constants.WRAPPER) QueryWrapper<UpDataShippingNoteDTO> queryWrapper);


    HyShippingNote selectByIdForUpdate(@Param("id") String id);

    List<HyShippingNote> selectListByIdsForUpdate(@Param("ids") Collection<? extends Serializable> ids);


    HyShippingNoteTongJiDTO sameDayList(@Param("id") String id, @Param("i") String i);


    IPage<HyShippingNoteTongJiDTO> intransitList(
            Page<HyShippingNoteTongJiDTO> page, @Param(Constants.WRAPPER) QueryWrapper<HyShippingNoteTongJiDTO> queryWrapper,
            @Param("id") String id, @Param("i") String i);

    List<HyShippingNoteTongJiDTO> sameDayList2(@Param("id") String id, @Param("s") String s);

    List<HyShippingNote> signedList(@Param("id") String id, @Param("orderId") String orderId);

    IPage<HyShippingNoteDTO> tongjiList(
            Page<HyShippingNoteTongJiDTO> page, @Param(Constants.WRAPPER) QueryWrapper<HyShippingNoteTongJiDTO> queryWrapper,
            @Param("s") String s, @Param("id") String id, @Param("orderId") String orderId, @Param("sql") String sql);

    HyShippingNoteTongJiDTO sameDayListSql(@Param("id") String id, @Param("i") String i, @Param("sql") String sql, @Param("starData") String starData, @Param("endData") String endData);

    List<HyShippingNoteTongJiDTO> sameDayList2Sql(@Param("id") String id, @Param("s") String s, @Param("sql") String sql);

    IPage<HyShippingNoteTongJiDTO> sameDayList2SqlW(
            @Param("page") Page<HyShippingNoteTongJiDTO> page, @Param(Constants.WRAPPER) QueryWrapper<HyShippingNoteTongJiDTO> queryWrapper,
            @Param("customerId") String customerId, @Param("sql") String sql, @Param("starData") String starData, @Param("endData") String endData);

    IPage<HyShippingNoteDTO> tongjiRqList(Page<HyShippingNoteTongJiDTO> page, @Param(Constants.WRAPPER) QueryWrapper<HyShippingNoteTongJiDTO> queryWrapper, @Param("s") String s, @Param("id") String id, @Param("orderId") String orderId, @Param("star") String star, @Param("end") String end);


    BigDecimal getDriverDjsFeeByDriverId(@Param("driverId") String driverId);

    BigDecimal getDriverTotalFeeByDriverIdAndChannel(@Param("driverId") String driverId , @Param("payChannel") String payChannel);

    BigDecimal getCustomerDjsFee(@Param("customerId") String customerId);

    BigDecimal getCustomerTotalFeeByChannel(@Param("customerId") String customerId, @Param("channelType") String channelType);

    BigDecimal getTotalCostPayShipping(@Param("companyId") String companyId, @Param("channelType") String channelType);

    BigDecimal getTotalCostService(@Param("companyId") String companyId, @Param("channelType") String channelType);

    List<ShippingVo> getLuXian( @Param("startMonth") String startMonth,
                                @Param("endMonth") String endMonth,@Param("id") String id);

    List<ShippingVo> getLuXian2( @Param("startMonth") String startMonth,
                                @Param("endMonth") String endMonth,@Param("id") String id);

    List<ShippingVo> getLuXianName();


    String getDriverFeeSum(@Param("driverId")String id);

    @MapKey("driver_id")
    Map<String, Map<String,BigDecimal>> getCurMonthDriverFee(@Param("driverId")String driverId);

    @MapKey("driver_id")
    Map<String, Map<String,BigDecimal>> getCurMonthDriversFee(@Param("driverIds")Collection<? extends Serializable> driverIds);

    List<ShuiWuExportShippingNoteDTO> guoShuiShippingExport(@Param(Constants.WRAPPER) QueryWrapper<HyShippingNoteDTO> queryWrapper);

    int count2(@Param("driverId")String driverId, @Param("receiveAreaCode")String receiveAreaCode);

    IPage<YunFuTongShippingNoteDTO> getYunShuiBaoPageList(@Param("page")Page<YunFuTongShippingNoteDTO> page,@Param(Constants.WRAPPER)QueryWrapper<YunFuTongShippingNoteDTO> queryWrapper);
    IPage<ShiboEtcReportDTO> getShiboEtcList(@Param("page")Page<ShiboEtcReportDTO> page, @Param(Constants.WRAPPER)QueryWrapper<ShiboEtcReportDTO> queryWrapper);

    IPage<ShiboEtcReportDTO> getShiboEtcList1(@Param("page")Page<ShiboEtcReportDTO> page, @Param(Constants.WRAPPER)QueryWrapper<ShiboEtcReportDTO> queryWrapper);

    IPage<XlyReportDTO> getXlyEtcList(@Param("page") Page<XlyReportDTO> page, @Param(Constants.WRAPPER)QueryWrapper<XlyReportDTO> queryWrapper);

    Integer getCount(@Param(Constants.WRAPPER)QueryWrapper<HyShippingNote> queryWrapper);

    Integer getZtCount(@Param(Constants.WRAPPER)QueryWrapper<HyShippingNote> queryWrapper);


    List<ShuiWuExportShippingNoteDTO> newGuoShuiShippingExport(@Param(Constants.WRAPPER)QueryWrapper<HyShippingNoteDTO> queryWrapper);


    List<HyShippingNoteDTO> getXlyReportList(@Param(Constants.WRAPPER)QueryWrapper<HyShippingNoteDTO> queryWrapper);

    List<shiboHyShippingNoteExportXlsDTO> getshiboExportXlsList(@Param(Constants.WRAPPER)QueryWrapper<HyShippingNoteDTO> queryWrapper);

    List<UpDataShippingNoteDTO2> getUpDataPageList1(@Param(Constants.WRAPPER)QueryWrapper<UpDataShippingNoteDTO2> queryWrapper);
}
